<?php
$datetimeFormat = Configure::read('Setting.datetime_format');
?>
<div class="profile-detail form-horizontal">
    <div class="control-group">
        <div class="control-label"><?php echo __('Name') ?></div>
        <div class="controls"><?php echo $user['User']['fullname'] ?></div>
    </div>
    <div class="control-group">
        <div class="control-label"><?php echo __('Username') ?></div>
        <div class="controls"><?php echo $user['User']['username'] ?></div>
    </div>
    <div class="control-group">
        <div class="control-label"><?php echo __('Email') ?></div>
        <div class="controls"><?php echo $user['User']['email'] ?></div>
    </div>
    <div class="control-group">
        <div class="control-label"><?php echo __('Register Date') ?></div>
        <div class="controls"><?php echo date($datetimeFormat, strtotime($user['User']['created'])) ?></div>
    </div>
    <div class="control-group">
        <div class="control-label"><?php echo __('Last Visit Date') ?></div>
        <div class="controls"><?php if(!empty($user['User']['last_login_at'])){
            echo date($datetimeFormat, strtotime($user['User']['last_login_at']));
        }?></div>
    </div>
</div>
<?php if(!empty($tests)): ?>
<table class="table table-bordered">
    <thead>
        <th width="10">&nbsp;</th>
        <th><?php echo __('Exam Name') ?></th>
        <th><?php echo __('Score') ?></th>
        <th><?php echo __('Result') ?></th>
        <th><?php echo __('Time') ?></th>
    </thead>
    <tbody>
        <?php foreach($tests as $k => $test): ?>
        <td><?php echo $k + 1 ?></td>
        <td><?php echo $test['Exam']['name'] ?></td>
        <td><?php echo $test['Test']['score'] ?></td>
        <td><?php echo $test['Test']['is_passed'] ? __('Passed') : __('Failed') ?></td>
        <td><?php echo date($datetimeFormat, strtotime($test['Test']['created'])) ?></td>
        <?php endforeach; ?>
    </tbody>
</table>
<?php endif; ?>